function getQueryString(name) {
    var svalue  = location.href.match(new RegExp("[\?\&]" + name + "=([^\&]*)(\&?)","i"));
    return svalue ? svalue[1] : svalue;
}
angular.module('newsview.controller',[])
  .controller('newsviewCtrl',['$scope','$timeout' ,'$localstorage','$ionicPopup','newsviewService','$state','loginService','$ionicHistory',function($scope,$timeout,$localstorage,$ionicPopup,newsviewService,$state,loginService,$ionicHistory){

    $scope.params={};
    $scope.NewsViewJsonData={};
    $scope.params=newsviewService.getParams();
    $scope.visible=true; //初始
    $scope.$on('$ionicView.enter', function(event, data) {
            var id=  getQueryString('id');
            newsviewService.get_newsviewInfo(id).then(function(data){
                              $scope.NewsViewJsonData=data;
                            },function(error){
                              var alertPopup=$ionicPopup.alert({
                                title:'获取在网导航失败！',
                                template:"异常错误",
                                okText: '确定', // String (默认: 'OK')。OK按钮的文字。
                                okType: 'item-customer-bg-darkred', // String (默认: 'button-positive')。OK按钮的类型。
                              });
                            });
    });
    $scope.goBack = function(){
      $ionicHistory.goBack();//back到之前的路由
    }
  }]);
